﻿@using Askmethat.Aspnet.JsonLocalizer.Localizer
@inject IJsonStringLocalizer<ListModel> Localizer
@inject IDataService DataService
@{
    var blog = await DataService.CustomFields.GetBlogSettings();
    var catsUnordered = await DataService.BlogPosts.Categories();
    var cats = catsUnordered.OrderByDescending(c => c.PostCount);
}

<!-- ##### Footer Area Start ##### -->
<footer class="footer-area">
    <div class="container">
        <div class="row">
            <!-- Footer Widget Area -->
            <div class="col-12 col-sm-6 col-xl-4">
                <div class="footer-widget mb-70">
                    <!-- Logo -->
                    <h6 class="widget-title">@Localizer["newsletter"]</h6>

                    <h2 class="newsletter-title" id="ttlNewsletter" style="display:none">@Localizer["thank-you"]</h2>

                    <div class="subscribe-form" id="frmNewsletter">
                        <p>@Localizer["join-subscribers"]</p>
                        <div class="footer-nl-area">
                            <form>
                                <input type="email" name="nl-email" class="form-control" id="nlEmail" placeholder="@Localizer["enter-email"]">
                                <button type="submit" onclick="return subscribeClick();"><i class="fa fa-paper-plane" aria-hidden="true"></i></button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Footer Widget Area -->
            <div class="col-12 col-sm-6 col-xl-4">
                <div class="footer-widget mb-70">
                    <h6 class="widget-title">@Localizer["categories", true]</h6>
                    @if (cats.Any())
                    {
                        var cnt = 1;
                        foreach (var cat in cats)
                        {
                            if (cnt < 6)
                            {
                                <div class="single-blog-post d-flex">
                                    <div class="category-thumbnail">
                                        <i class="fa fa-tags" aria-hidden="true"></i>
                                    </div>
                                    <div class="post-content">
                                        <a href="~/categories/@cat.Category" class="post-title">@cat.Category (@cat.PostCount)</a>
                                    </div>
                                </div>
                            }
                            cnt++;
                        }
                    }
                </div>
            </div>

            <!-- Footer Widget Area -->
            <div class="col-12 col-sm-6 col-xl-4">
                <div class="footer-widget mb-70">
                    <h6 class="widget-title">About @blog.Title</h6>
                    <!-- Contact Address -->
                    <div class="contact-address">
                        <p>@blog.Description</p>
                    </div>
                    <!-- Footer Social Area -->
                    <div class="footer-social-area">
                        @foreach (var field in blog.SocialFields)
                        {
                        <a href="@field.Content" class="@field.Title.ToLower()"><i class="fa @field.Icon"></i></a>
                        }
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Copywrite Area -->
    <div class="copywrite-area">
        <div class="container">
            <div class="row align-items-center">
                <!-- Copywrite Text -->
                <div class="col-12 col-sm-6">
                    <p class="copywrite-text">
                        <!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
                        @blog.Title &copy;
                        <script>document.write(new Date().getFullYear());</script> All rights reserved | This template is made with <i class="fa fa-heart-o" aria-hidden="true"></i> by <a href="https://colorlib.com" target="_blank">Colorlib</a>
                        <!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
                    </p>
                </div>
                <div class="col-12 col-sm-6">
                    <nav class="footer-nav">
                        <ul>
                            <li><a href="~/">@Localizer["home"]</a></li>
                            <li><a href="~/blog">@Localizer["blog"]</a></li>
                            <li><a href="~/admin">@Localizer["admin"]</a></li>
                        </ul>
                    </nav>
                </div>
            </div>
        </div>
    </div>
</footer>
<script src="~/themes/vizew/js/jquery/jquery-2.2.4.min.js"></script>
<script src="~/themes/vizew/js/bootstrap/popper.min.js"></script>
<script src="~/themes/vizew/js/bootstrap/bootstrap.min.js"></script>
<script src="~/themes/vizew/js/plugins/plugins.js"></script>
<script src="~/themes/vizew/js/active.js"></script>
<script src="~/themes/vizew/js/prism.js"></script>

<partial name="~/Views/Shared/FooterScript.cshtml" />